package com.fpt.edu.vn.h2tv.dao.entity;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * TbBookCategoryId entity. @author MyEclipse Persistence Tools
 */
@Embeddable
public class TbBookCategoryId implements java.io.Serializable {

	// Fields

	private Short categoryid;
	private Integer bookid;

	// Constructors

	/** default constructor */
	public TbBookCategoryId() {
	}

	/** full constructor */
	public TbBookCategoryId(Short categoryid, Integer bookid) {
		this.categoryid = categoryid;
		this.bookid = bookid;
	}

	// Property accessors

	@Column(name = "CATEGORYID", nullable = false)
	public Short getCategoryid() {
		return this.categoryid;
	}

	public void setCategoryid(Short categoryid) {
		this.categoryid = categoryid;
	}

	@Column(name = "BOOKID", nullable = false)
	public Integer getBookid() {
		return this.bookid;
	}

	public void setBookid(Integer bookid) {
		this.bookid = bookid;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof TbBookCategoryId))
			return false;
		TbBookCategoryId castOther = (TbBookCategoryId) other;

		return ((this.getCategoryid() == castOther.getCategoryid()) || (this
				.getCategoryid() != null && castOther.getCategoryid() != null && this
				.getCategoryid().equals(castOther.getCategoryid())))
				&& ((this.getBookid() == castOther.getBookid()) || (this
						.getBookid() != null && castOther.getBookid() != null && this
						.getBookid().equals(castOther.getBookid())));
	}

	public int hashCode() {
		int result = 17;

		result = 37
				* result
				+ (getCategoryid() == null ? 0 : this.getCategoryid()
						.hashCode());
		result = 37 * result
				+ (getBookid() == null ? 0 : this.getBookid().hashCode());
		return result;
	}

}